package com.cch.cooperation.common.util;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

import java.util.Date;

/**
 * id 工具类
 *
 * @author cch on 2020/11/11
 **/
public class SnowflakeIdUtil {

    static Snowflake snowflake = IdUtil.createSnowflake(new Date().getTime() % 30, 1);

    public static Long getId() {
        return snowflake.nextId();
    }

    public static String getIdStr() {
        return getId().toString();
    }

    public static String getIdHex() {
        return Long.toHexString(getId()).toUpperCase();
    }
}
